package 周赛;

import org.junit.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;

public class 找出不同的二进制字符串 {

    public String findDifferentBinaryString(String[] nums) {
//        List<String> lists = Arrays.asList(nums);
        HashSet<String> set = new HashSet<>();
        for (int i = 0; i < nums.length; i++) {
           set.add(nums[i]);
        }
        int length = nums[0].length();
        long max=(long)Math.pow(2,length);
        for (long i = 0; i < max; i++) {
            String s = Long.toBinaryString(i);
            StringBuilder builder = new StringBuilder();
            for (int j = 0; j < length - s.length(); j++) {
                builder.append(0);
            }
            builder.append(s);
            if (!set.contains(builder.toString()))
                return builder.toString();
        }
        return new String();
    }


    @Test
    public void tets(){
        String[] strings = {"0000000111","0000001001","0000000100","0000000001","0000000010","1111111111","0000000101","0000000000","0000001000","0000000110"};
//        strings[0]="01";
//        strings[1]="10";
        System.out.println(findDifferentBinaryString(strings));
//        StringBuilder builder = new StringBuilder();
//        builder.append("0123");
//        System.out.println(builder.toString());
    }
}
